package com.bunnyhsu.utils;

import com.bunnyhsu.dto.Result;

/**
 * Created by xl on 2018/4/10.
 */
public class ResultUtil {

    public static Result success(Object data, String msg)
    {
        Result<Object> result = new Result<Object>();
        result.setData(data);
        result.setCode(0);
        result.setMsg(msg);
        return result;
    }
    public static Result success()
    {
        Result<Object> result = new Result<>();
        result.setCode(0);
        return result;
    }
    public static Result success(Object data)
    {
        Result<Object> result = new Result<Object>();
        result.setData(data);
        result.setCode(0);
        return result;
    }
    public static Result fail(int code, String msg)
    {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
